package com.another.bidservice.utils.util.query;

public class QureyEnums {
    public enum QueryEnum {
        EQUAL("等于", "="),
        NOT_EQUAL("不等于", "!="),
        LESS_THAN("小于", "<"),
        LESS_THAN_OR_EQUAL_TO("小于或等于", "<="),
        MORE_THAN("大于", ">"),
        GREATER_OR_EQUAL_TO("大于或等于", ">="),
        CONTAIN("包含", "LIKE"),
        NOT_INCLUDED("不包含", "NOT IN"),
        INLIST("在列表中", "IN"),
        BETWEEN("介于", "BETWEEN");

        private String index;
        private String value;

        QueryEnum(String index, String value) {
            this.index = index;
            this.value = value;
        }

        public static String getDisplayIndex(String value) {
            for (QueryEnum queryEnum : QueryEnum.values()) {
                if (queryEnum.value.equals(value)) {
                    return queryEnum.index;
                }
            }
            return null;
        }

        public static String getDisplayValue(String index) {
            for (QueryEnum queryEnum : QueryEnum.values()) {
                if (queryEnum.index.equals(index)) {
                    return queryEnum.value;
                }
            }
            return null;
        }

        public String getIndex() {
            return index;
        }

        public void setIndex(String index) {
            this.index = index;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

    }


    public enum PostQueryEnum {
        AND("且", "AND"), OR("或", "OR");

        private String index;
        private String value;

        PostQueryEnum(String index, String value) {
            this.index = index;
            this.value = value;
        }

        public static String getDisplayIndex(String value) {
            for (PostQueryEnum postQueryEnum : PostQueryEnum.values()) {
                if (postQueryEnum.value.equals(value)) {
                    return postQueryEnum.index;
                }
            }
            return null;
        }

        public static String getDisplayValue(String index) {
            for (PostQueryEnum postQueryEnum : PostQueryEnum.values()) {
                if (postQueryEnum.index.equals(index)) {
                    return postQueryEnum.value;
                }
            }
            return null;
        }

        public String getIndex() {
            return index;
        }

        public void setIndex(String index) {
            this.index = index;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

    }
}
